<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
        <div class="col-xs-12 col-sm-8">

            <div class="radio">
                {foreach name="typeList" item="vo"}
                <label for="row[type]-{$key}"><input id="row[type]-{$key}" name="row[type]" type="radio" value="{$key}" {in name="key" value="list" }checked{/in} /> {$vo}</label>
                {/foreach}
            </div>
        </div>
    </div>
    <div class="form-group tf tf-list tf-channel">
        <label for="c-model_id" class="control-label col-xs-12 col-sm-2">{:__('Model_id')}:</label>
        <div class="col-xs-12 col-sm-8">
            <select name="row[model_id]" id="c-model_id" class="form-control">
                {foreach name="modelList" item="vo"}
                <option value="{$vo.id}" data-channeltpl="{$vo.channeltpl}" data-listtpl="{$vo.listtpl}" data-showtpl="{$vo.showtpl}">{$vo.name}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="form-group">
        <label for="parent_id" class="control-label col-xs-12 col-sm-2">{:__('上级栏目')}:</label>
        <div class="col-xs-12 col-sm-8">
            <!--@formatter:off-->
            <select name="row[parent_id]" data-rule="required" id="parent_id" class="form-control">
                <option value="0">{:__('None')}</option>
                {foreach name="channelList" item="vo"}
                <option value="{$vo.id}" {if input('parent_id')==$vo.id }selected {/if} {if $vo.type!=='link'}data-model="{$vo.model_id}"{/if}>{$vo.name}</option>
                {/foreach}
            </select>
            <!--@formatter:on-->
        </div>
    </div>
    <div class="form-group">
        <label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-name" data-rule="required; channelname" class="form-control" name="row[name]" placeholder="支持批量录入，一行一条记录，格式：名称|自定义URL名称" data-toggle="tooltip" data-html="true" title="如需一次录入多个栏目请换行输入，批量录入时将忽略自定义名称<br>格式：名称|自定义URL名称"></textarea>
        </div>
    </div>
    <div class="form-group">
        <label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-image" data-rule="" class="form-control" size="50" name="row[image]" type="text">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-image"></span>
            </div>
            <ul class="row list-inline plupload-preview" id="p-image"></ul>
        </div>
    </div>
    <div class="form-group">
        <label for="c-seotitle" class="control-label col-xs-12 col-sm-2">{:__('Seotitle')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-seotitle" data-rule="" class="form-control" name="row[seotitle]" type="text" value="" placeholder="为空时将使用栏目名称">
        </div>
    </div>
    <div class="form-group tf tf-channel tf tf-list">
        <label for="c-keywords" class="control-label col-xs-12 col-sm-2">{:__('Keywords')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-keywords" data-rule="" class="form-control" name="row[keywords]" data-role="tagsinput" type="text">
        </div>
    </div>
    <div class="form-group tf tf-channel tf tf-list">
        <label for="c-description" class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-description" data-rule="" class="form-control" name="row[description]"></textarea>
        </div>
    </div>
    <div class="form-group">
        <label for="c-diyname" class="control-label col-xs-12 col-sm-2">{:__('Diyname')}:</label>
        <div class="col-xs-12 col-sm-4">
            <input id="c-diyname" data-rule="required(single); diyname" class="form-control" name="row[diyname]" type="text" data-tip="用于伪静态规则中[:diyname]替换">
        </div>
    </div>
    <div class="form-group tf tf-link hidden">
        <label for="c-outlink" class="control-label col-xs-12 col-sm-2">{:__('Outlink')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-outlink" data-rule="required" class="form-control" name="row[outlink]" type="text">
                <span class="input-group-btn">
                    <a href="javascript:" data-url="cms/ajax/get_link_list" class="btn btn-primary btn-select-link" title="选择链接" style="margin-left:3px;"><i class="fa fa-link"></i> 选择链接</a>
                </span>
                <span class="msg-box n-right"></span>
            </div>
            <div id="outlink-extend"></div>
            <input type="hidden" name="row[linktype]" value="" />
            <input type="hidden" name="row[linkid]" value="0" />
        </div>
    </div>
    <div class="form-group tf tf-channel tf-list">
        <label for="c-channeltpl" class="control-label col-xs-12 col-sm-2">{:__('Channeltpl')}:</label>
        <div class="col-xs-12 col-sm-4">
            <input id="c-channeltpl" data-rule="required" class="form-control selectpage" name="row[channeltpl]" data-source="cms/ajax/get_template_list" data-params='{"type":"channel"}' data-primary-key="name" data-field="name" type="text" placeholder="自定义模板文件必须以channel开头">
        </div>
    </div>
    <div class="form-group tf tf-channel tf-list">
        <label for="c-listtpl" class="control-label col-xs-12 col-sm-2">{:__('Listtpl')}:</label>
        <div class="col-xs-12 col-sm-4">
            <input id="c-listtpl" data-rule="required" class="form-control selectpage" name="row[listtpl]" data-source="cms/ajax/get_template_list" data-params='{"type":"list"}' data-primary-key="name" data-field="name" type="text" placeholder="自定义模板文件必须以list开头">
        </div>
    </div>
    <div class="form-group tf tf-channel tf-list">
        <label for="c-showtpl" class="control-label col-xs-12 col-sm-2">{:__('Showtpl')}:</label>
        <div class="col-xs-12 col-sm-4">
            <input id="c-showtpl" data-rule="required" class="form-control selectpage" name="row[showtpl]" data-source="cms/ajax/get_template_list" data-params='{"type":"show"}' data-primary-key="name" data-field="name" type="text" placeholder="自定义模板文件必须以show开头">
        </div>
    </div>
    <div class="form-group tf tf-channel tf-list">
        <label for="c-pagesize" class="control-label col-xs-12 col-sm-2">{:__('Pagesize')}:</label>
        <div class="col-xs-12 col-sm-4">
            <input id="c-pagesize" data-rule="required" class="form-control" name="row[pagesize]" type="number" value="10" data-tip="用于前台列表页分页">
        </div>
    </div>
    <div class="form-group tf tf-list tf-channel">
        <label for="c-listtype" class="control-label col-xs-12 col-sm-2">{:__('Listtype')}:</label>
        <div class="col-xs-12 col-sm-4">
            <select name="row[listtype]" id="c-listtype" class="form-control">
                {foreach name="listtypeList" item="vo"}
                <option value="{$key}">{$vo}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="form-group tf tf-channel tf-list">
        <label for="c-vip" class="control-label col-xs-12 col-sm-2">{:__('VIP Limit')}:</label>
        <div class="col-xs-12 col-sm-4">
            {if $vipList}
            <select name="row[vip]" id="c-vip" class="form-control">
                {foreach name="vipList" id="item"}
                <option value="{$item.level}">{$item.name} Lv:{$item.level}</option>
                {/foreach}
            </select>
            {else/}
            <div class="alert alert-warning-light" style="margin-bottom:0;">未安装或未配置VIP会员组</div>
            {/if}
        </div>
    </div>
    <div class="form-group tf tf-channel tf-list">
        <label class="control-label col-xs-12 col-sm-2">{:__('Iscontribute')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-iscontribute" name="row[iscontribute]" type="hidden" value="0">
            <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-iscontribute" data-yes="1" data-no="0">
                <i class="fa fa-toggle-on text-success fa-flip-horizontal text-gray fa-2x"></i>
            </a>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Isnav')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-isnav" name="row[isnav]" type="hidden" value="0">
            <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-isnav" data-yes="1" data-no="0">
                <i class="fa fa-toggle-on text-success fa-flip-horizontal text-gray fa-2x"></i>
            </a>
        </div>
    </div>
    <div id="extend">{include file="cms/common/fields"}</div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">

            <div class="radio">
                {foreach name="statusList" item="vo"}
                <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="normal" }checked{/in} /> {$vo}</label>
                {/foreach}
            </div>

        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>

<script type="text/html" id="outlinktpl">
    <div class="alert alert-info-light" style="margin-bottom:0;position:relative;margin-top:10px;">
        类型：<%=type=='page'?'单页':(type=='special'?'专题':'自定义表单')%><br>
        标题：<%=title%><br>
        链接：<a href="<%=url%>" target="_blank"><%=url%></a><br>
        <a href="javascript:" class="btn btn-info btn-remove-link" style="position:absolute;right:10px;top:10px;color:#fff;text-decoration: none;"><i class="fa fa-close"></i> 移除</a>
    </div>
</script>
